package com.coolingme.demo.power.interfaceadpter;

/**
 * 电源适配器，将220V交流电转为5V直流电
 *
 * @author wangyue
 * @date 2020-09-19 23:38
 */
public class PowerAdpter implements DC {

    private AC220Adaptee aC220Adaptee;

    public PowerAdpter(AC220Adaptee aC220Adaptee) {
        this.aC220Adaptee = aC220Adaptee;
    }

    @Override
    public int output5V() {
        int input = aC220Adaptee.outputAC220V();
        int output = input / 44;
        System.out.println("将" + input + "V转为" + output + "V");
        return output;
    }

    @Override
    public int output10V() {
        int input = aC220Adaptee.outputAC220V();
        int output = input / 22;
        System.out.println("将" + input + "V转为" + output + "V");
        return output;
    }

    @Override
    public int output20V() {
        int input = aC220Adaptee.outputAC220V();
        int output = input / 11;
        System.out.println("将" + input + "V转为" + output + "V");
        return output;
    }
}
